<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>

    </div>
    <script>
        document.cookie = 'name=xiaoming';
        document.cookie = 'password=1212122';
        document.cookie = 'gender=1';
        let str = document.cookie;
            let arr = str.split(';');
            // 
            // console.log(arr2);
            // let arr3 = []
            // console.log(arr3);
            // return arr3
       function find(name){
           for(var i = 0; i<arr.length; i++){
            let arr2 = arr[i].split('=');
            console.log(arr2);
            if(name == arr2[0]){
                return arr2[1]
            }
           }
       }
    //    console.log(find(" password"));

       console.log(localStorage.getItem('name'));
    </script>

</body>
</html>